<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<script src="../js/vue.js" type="text/javascript" charset="utf-8"></script>
		<title>前后端调用-post</title>
		<script src="../js/axios.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div id="app">
			<h1>前后端调用-post测试</h1>
		</div>
		<script>
		/**
		 * 需求:把id = 240,改为 name = 小佬  age = 24  sex = "男"
		 */
				let user = {
					id : 240,
					name : "小佬",
					age : 24,
					sex : "男"
				}
				let url = "http://localhost:8090/axios/update"
				axios.put(url,user).then(
					promise =>{
						console.log(promise.data)
					}
				)
				
				/**
				 * 参数重复
				 * 解决方案: restful + 对象
				 */
				let name = '大佬'
				let url2 = `http://localhost:8090/axios/updateByName/${name}`
				let user2 = {
					name : "琨琨",
					age : 25,
					sex : "男"
				}
				axios.put(url2,user2).then(
					promise => {
						console.log(promise.data)
					}
				)
		</script>
	</body>
</html>
